<?php

namespace app\common\model\supplier;

use app\common\model\BaseModel;

/**
 * 商户分类模型
 */
class CategoryStatus extends BaseModel
{
    protected $name = 'supplier_category_status';
    protected $pk = 'id';

    /**
     * 所有分类
     * @return \think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function getALL()
    {
        $model = new static;
        return $model->order(['create_time' => 'asc'])->select();
    }
    /**
     * 详情
     */
    public static function detail($category_id)
    {
       return (new static())->find($category_id);
    }

    public static function findCategory($category_id,$shop_supplier_id)
    {
       return (new static())->where('category_id','=',$category_id)->where('shop_supplier_id','=',$shop_supplier_id)->find();
    }

    public static function addData($data){
        return (new static())->add($data);
    }
}